﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

//服务端状态管理--Session
public partial class Session : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["username"] != null)
        {
            Label1.Text = Session["username"].ToString();
        }
        else
        {
            Response.Redirect("~/SessionLogin.aspx");
        }
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        //删除Session状态集中删除所有键和值
        Session.Clear();
    }
}